/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package servlet;

import dao.MemberDao;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author zhang
 */
@WebServlet("/ams")
public class AddMemberServlet extends HttpServlet{

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String name=req.getParameter("nname");
        String gender=req.getParameter("gname");
        String phone=req.getParameter("pname");
        String email=req.getParameter("ename");
        String password=req.getParameter("passname");
        String profession=req.getParameter("oname");
        String liketype=req.getParameter("iname");
        int i=new MemberDao().addMember(name,gender,phone,email,password,profession,liketype);
        resp.setContentType("text/html;charset=utf-8");
        if(i!=0){
           resp.getWriter().println("<h1>注册成功！！！</h1>");
        }
        else
        {
           resp.getWriter().println("<h1>注册失败！！！</h1>");
        }
        resp.getWriter().println("<a href='index'>返回</a>");
        
    }
    
}
